package mapper;

import entity.Book;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

public class UserMapperImpl implements UserMapper{
    // 以前所有的操作都是用sqlSession执行
    // 现在都使用SqlSessionTemplate
    private SqlSessionTemplate sqlSession;

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }

    @Override
    public List<Book> getBook() {
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        return mapper.getBook();
    }
}
